#ifndef _comm_protocol_h_
#define _comm_protocol_h_
#include	"stdint.h"


#define mesg_max		(10)
#define buffer_max	(128)
typedef struct m_prot{
	uint8_t 	status;//0->ideal; 1->rxing
	uint8_t 	len;
	uint8_t 	index;	
	uint8_t 	buffer[buffer_max];	
	uint32_t	ID;
}mesg_prot, *pmesg_prot;
typedef struct q_prot{
	uint8_t head;
	uint8_t tail;
	uint8_t size;
	mesg_prot mesg_queue[mesg_max];
}list_prot, *plist_prot;

typedef uint8_t (*FunType_CANTx)(uint8_t *buffer, uint8_t len, uint32_t id);
typedef uint8_t (*FunType_bufferTx)(uint8_t *buffer, uint8_t len);
typedef uint8_t (*FunType)(void);
typedef uint8_t (*FunType_para1)(pmesg_prot pmesg);
typedef struct{
	FunType			rxFunc;
	FunType			txFunc;
	FunType_para1	proFunc;
}func_prot;

#define  	MesgGroupMax	(6)
extern func_prot 	func_register[];
extern list_prot 	mesg_queue_prot[];

extern uint8_t list_check(uint8_t MesgGroup);
extern void func_register_init(uint8_t Group, FunType rxFunc, FunType txFunc,FunType_para1 proFunc);
extern void list_insert(pmesg_prot pmesg, uint8_t MesgGroup);
#endif
